package org.yzh.codec;

import io.github.yezhihao.protostar.FieldFactory;
import io.netty.buffer.ByteBufUtil;
import io.netty.buffer.Unpooled;
import org.yzh.protocol.basics.JTMessage;
import org.yzh.protocol.codec.JTMessageDecoder;

/**
 * 解码分析
 * @author yezhihao
 * @home https://gitee.com/yezhihao/jt808-server
 */
public class Elucidator {

    private static JTMessageDecoder decoder;

    static {
        FieldFactory.EXPLAIN = true;
        decoder = new JTMessageDecoder("org.yzh.protocol");
    }

    public static void main(String[] args) {
        String hex = "01020014002005202365028e366c392b67506a6a30525a69365a79316f3363739e";

        JTMessage decode = decoder.decode(Unpooled.wrappedBuffer(ByteBufUtil.decodeHexDump(hex)));
        System.out.println("hex==========="+hex);
        //System.out.println(decode.getHeader());
    }
}